use serde::Deserialize;
use std::error::Error;
use std::fs;

#[derive(Debug,Clone,Deserialize)]
pub struct Config{
    pub port:u16
}

pub fn load_config() -> Result<Config,Box<dyn Error>>{
    let context = fs::read_to_string("conf.toml")?;
    let config = toml::from_str(&context)?;
    Ok(config)
}